eventObj={
	beforeSave:function(){
		$("select[name='SDdetail_layout_id']").each(function(){
			var $option = $(this).children("option:selected");
			$("input[name='SDdetail_layout_name']").val($option.text());
		});
		$("select[name='SDdetail_report_id']").each(function(){
			var $option = $(this).children("option:selected");
			$("input[name='SDdetail_report_name']").val($option.text());
		});
		$("select[name='SDdetail_page_id'] ").each(function(){
			var $option = $(this).children("option:selected");
			$("input[name='SDdetail_page_name']").val($option.text());
		});
	},
	initForm:function(data){
		var reportId = $("select[name='SDdetail_report_id']").val();
		loadField(reportId,data);
		$("select[name='SDdetail_report_id']").change(function(){
			loadField($(this).val(),null);
		});
	}
}

function loadField(reportId,value){
 	$.ajax({
		type: "POST",
		url:baseURL+"/report/commsearch/commsearchlist/loadField.do",
		dataType:'json',
		data:{reportId:reportId},
		success:function(data){
			var html = "<option></option>";
			for(var key in data){
				html += "<option value='"+data[key].fieldName+"'>"+data[key].displayName+"</option>";
			}
			$("select[name='SDdetail_x_field_name']").children("option").remove();
			$("select[name='SDdetail_y_field_name']").children("option").remove();
			$("select[name='SDdetail_statics_field_name']").children("option").remove();
			$("select[name='SDdetail_x_field_name']").append(html);
			$("select[name='SDdetail_y_field_name']").append(html);
			$("select[name='SDdetail_statics_field_name']").append(html);
			if(value){
				$("select[name='SDdetail_x_field_name']>option").each(function(){
					if($(this).val()==value.x_field_name){
						$(this).attr("selected",true);
					}
				});
				$("select[name='SDdetail_y_field_name']>option").each(function(){
					if($(this).val()==value.y_field_name){
						$(this).attr("selected",true);
					}
				});
				$("select[name='SDdetail_statics_field_name']>option").each(function(){
					if($(this).val()==value.statics_field_name){
						$(this).attr("selected",true);
					}
				});
			}
		}
	});
}